
package de.justphil.tcg.tcgandroidclient.gui.gameboard;

import de.justphil.tcg.tcgandroidclient.content.TCGContentAdapter;
import android.database.ContentObserver;
import android.graphics.Bitmap;
import android.os.Handler;
import android.os.Looper;

public class PropertyUpdater extends ContentObserver {
	
	private final TCGContentAdapter contentFetcher;
	private final Card card;
	private final int propertyType;
	
	public PropertyUpdater(Looper looper, TCGContentAdapter contentFetcher, Card card,
			int propertyType) {
	
		super(new Handler(looper));
		this.contentFetcher = contentFetcher;
		this.card = card;
		this.propertyType = propertyType;
	}
	
	@Override
	public void onChange(boolean selfChange) {
	
		super.onChange(selfChange);
		Bitmap bmp = contentFetcher.readProperty(propertyType, null);
		card.updateProperty(propertyType, bmp);

	}
}
